//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS OSIS service.
///
/// Use the Amazon OpenSearch Ingestion API to create and manage ingestion pipelines. OpenSearch Ingestion is a  fully managed data collector that delivers real-time log and trace data to OpenSearch Service domains. For more information, see Getting data into your cluster using OpenSearch Ingestion.
public struct OSIS: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the OSIS client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            serviceName: "OSIS",
            serviceIdentifier: "osis",
            serviceProtocol: .restjson,
            apiVersion: "2022-01-01",
            endpoint: endpoint,
            errorType: OSISErrorType.self,
            xmlNamespace: "http://osis.amazonaws.com/doc/2022-01-01",
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }





    // MARK: API Calls

    /// Creates an OpenSearch Ingestion pipeline. For more information, see Creating Amazon OpenSearch Ingestion pipelines.
    @Sendable
    @inlinable
    public func createPipeline(_ input: CreatePipelineRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreatePipelineResponse {
        try await self.client.execute(
            operation: "CreatePipeline", 
            path: "/2022-01-01/osis/createPipeline", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates an OpenSearch Ingestion pipeline. For more information, see Creating Amazon OpenSearch Ingestion pipelines.
    ///
    /// Parameters:
    ///   - bufferOptions: Key-value pairs to configure persistent buffering for the pipeline.
    ///   - encryptionAtRestOptions: Key-value pairs to configure encryption for data that is written to a persistent buffer.
    ///   - logPublishingOptions: Key-value pairs to configure log publishing.
    ///   - maxUnits: The maximum pipeline capacity, in Ingestion Compute Units (ICUs).
    ///   - minUnits: The minimum pipeline capacity, in Ingestion Compute Units (ICUs).
    ///   - pipelineConfigurationBody: The pipeline configuration in YAML format. The command accepts the pipeline configuration as a string or within a .yaml file. If you provide the configuration as a string, each new line must be escaped with \n.
    ///   - pipelineName: The name of the OpenSearch Ingestion pipeline to create. Pipeline names are unique across the pipelines owned by an account within an Amazon Web Services Region.
    ///   - tags: List of tags to add to the pipeline upon creation.
    ///   - vpcOptions: Container for the values required to configure VPC access for the pipeline. If you don't specify these values, OpenSearch Ingestion creates the pipeline with a public endpoint.
    ///   - logger: Logger use during operation
    @inlinable
    public func createPipeline(
        bufferOptions: BufferOptions? = nil,
        encryptionAtRestOptions: EncryptionAtRestOptions? = nil,
        logPublishingOptions: LogPublishingOptions? = nil,
        maxUnits: Int,
        minUnits: Int,
        pipelineConfigurationBody: String,
        pipelineName: String,
        tags: [Tag]? = nil,
        vpcOptions: VpcOptions? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreatePipelineResponse {
        let input = CreatePipelineRequest(
            bufferOptions: bufferOptions, 
            encryptionAtRestOptions: encryptionAtRestOptions, 
            logPublishingOptions: logPublishingOptions, 
            maxUnits: maxUnits, 
            minUnits: minUnits, 
            pipelineConfigurationBody: pipelineConfigurationBody, 
            pipelineName: pipelineName, 
            tags: tags, 
            vpcOptions: vpcOptions
        )
        return try await self.createPipeline(input, logger: logger)
    }

    /// Deletes an OpenSearch Ingestion pipeline. For more information, see Deleting Amazon OpenSearch Ingestion pipelines.
    @Sendable
    @inlinable
    public func deletePipeline(_ input: DeletePipelineRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeletePipelineResponse {
        try await self.client.execute(
            operation: "DeletePipeline", 
            path: "/2022-01-01/osis/deletePipeline/{PipelineName}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes an OpenSearch Ingestion pipeline. For more information, see Deleting Amazon OpenSearch Ingestion pipelines.
    ///
    /// Parameters:
    ///   - pipelineName: The name of the pipeline to delete.
    ///   - logger: Logger use during operation
    @inlinable
    public func deletePipeline(
        pipelineName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeletePipelineResponse {
        let input = DeletePipelineRequest(
            pipelineName: pipelineName
        )
        return try await self.deletePipeline(input, logger: logger)
    }

    /// Retrieves information about an OpenSearch Ingestion pipeline.
    @Sendable
    @inlinable
    public func getPipeline(_ input: GetPipelineRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetPipelineResponse {
        try await self.client.execute(
            operation: "GetPipeline", 
            path: "/2022-01-01/osis/getPipeline/{PipelineName}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves information about an OpenSearch Ingestion pipeline.
    ///
    /// Parameters:
    ///   - pipelineName: The name of the pipeline.
    ///   - logger: Logger use during operation
    @inlinable
    public func getPipeline(
        pipelineName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetPipelineResponse {
        let input = GetPipelineRequest(
            pipelineName: pipelineName
        )
        return try await self.getPipeline(input, logger: logger)
    }

    /// Retrieves information about a specific blueprint for OpenSearch Ingestion. Blueprints are templates for the configuration needed for a CreatePipeline request. For more information, see Using blueprints to create a pipeline.
    @Sendable
    @inlinable
    public func getPipelineBlueprint(_ input: GetPipelineBlueprintRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetPipelineBlueprintResponse {
        try await self.client.execute(
            operation: "GetPipelineBlueprint", 
            path: "/2022-01-01/osis/getPipelineBlueprint/{BlueprintName}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves information about a specific blueprint for OpenSearch Ingestion. Blueprints are templates for the configuration needed for a CreatePipeline request. For more information, see Using blueprints to create a pipeline.
    ///
    /// Parameters:
    ///   - blueprintName: The name of the blueprint to retrieve.
    ///   - format: The format format of the blueprint to retrieve.
    ///   - logger: Logger use during operation
    @inlinable
    public func getPipelineBlueprint(
        blueprintName: String,
        format: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetPipelineBlueprintResponse {
        let input = GetPipelineBlueprintRequest(
            blueprintName: blueprintName, 
            format: format
        )
        return try await self.getPipelineBlueprint(input, logger: logger)
    }

    /// Returns progress information for the current change happening on an OpenSearch Ingestion pipeline. Currently, this operation only returns information when a pipeline is being created. For more information, see Tracking the status of pipeline creation.
    @Sendable
    @inlinable
    public func getPipelineChangeProgress(_ input: GetPipelineChangeProgressRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetPipelineChangeProgressResponse {
        try await self.client.execute(
            operation: "GetPipelineChangeProgress", 
            path: "/2022-01-01/osis/getPipelineChangeProgress/{PipelineName}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns progress information for the current change happening on an OpenSearch Ingestion pipeline. Currently, this operation only returns information when a pipeline is being created. For more information, see Tracking the status of pipeline creation.
    ///
    /// Parameters:
    ///   - pipelineName: The name of the pipeline.
    ///   - logger: Logger use during operation
    @inlinable
    public func getPipelineChangeProgress(
        pipelineName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetPipelineChangeProgressResponse {
        let input = GetPipelineChangeProgressRequest(
            pipelineName: pipelineName
        )
        return try await self.getPipelineChangeProgress(input, logger: logger)
    }

    /// Retrieves a list of all available blueprints for Data Prepper. For more information, see Using blueprints to create a pipeline.
    @Sendable
    @inlinable
    public func listPipelineBlueprints(_ input: ListPipelineBlueprintsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListPipelineBlueprintsResponse {
        try await self.client.execute(
            operation: "ListPipelineBlueprints", 
            path: "/2022-01-01/osis/listPipelineBlueprints", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves a list of all available blueprints for Data Prepper. For more information, see Using blueprints to create a pipeline.
    ///
    /// Parameters:
    ///   - logger: Logger use during operation
    @inlinable
    public func listPipelineBlueprints(
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListPipelineBlueprintsResponse {
        let input = ListPipelineBlueprintsRequest(
        )
        return try await self.listPipelineBlueprints(input, logger: logger)
    }

    /// Lists all OpenSearch Ingestion pipelines in the current Amazon Web Services account and Region. For more information, see Viewing Amazon OpenSearch Ingestion pipelines.
    @Sendable
    @inlinable
    public func listPipelines(_ input: ListPipelinesRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListPipelinesResponse {
        try await self.client.execute(
            operation: "ListPipelines", 
            path: "/2022-01-01/osis/listPipelines", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists all OpenSearch Ingestion pipelines in the current Amazon Web Services account and Region. For more information, see Viewing Amazon OpenSearch Ingestion pipelines.
    ///
    /// Parameters:
    ///   - maxResults: An optional parameter that specifies the maximum number of results to return. You can use nextToken to get the next page of results.
    ///   - nextToken: If your initial ListPipelines operation returns a nextToken, you can include the returned nextToken in subsequent ListPipelines operations, which returns results in the next page.
    ///   - logger: Logger use during operation
    @inlinable
    public func listPipelines(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListPipelinesResponse {
        let input = ListPipelinesRequest(
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listPipelines(input, logger: logger)
    }

    /// Lists all resource tags associated with an OpenSearch Ingestion pipeline. For more information, see Tagging Amazon OpenSearch Ingestion pipelines.
    @Sendable
    @inlinable
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListTagsForResourceResponse {
        try await self.client.execute(
            operation: "ListTagsForResource", 
            path: "/2022-01-01/osis/listTagsForResource", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists all resource tags associated with an OpenSearch Ingestion pipeline. For more information, see Tagging Amazon OpenSearch Ingestion pipelines.
    ///
    /// Parameters:
    ///   - arn: The Amazon Resource Name (ARN) of the pipeline to retrieve tags for.
    ///   - logger: Logger use during operation
    @inlinable
    public func listTagsForResource(
        arn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListTagsForResourceResponse {
        let input = ListTagsForResourceRequest(
            arn: arn
        )
        return try await self.listTagsForResource(input, logger: logger)
    }

    /// Starts an OpenSearch Ingestion pipeline. For more information, see Starting an OpenSearch Ingestion pipeline.
    @Sendable
    @inlinable
    public func startPipeline(_ input: StartPipelineRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> StartPipelineResponse {
        try await self.client.execute(
            operation: "StartPipeline", 
            path: "/2022-01-01/osis/startPipeline/{PipelineName}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Starts an OpenSearch Ingestion pipeline. For more information, see Starting an OpenSearch Ingestion pipeline.
    ///
    /// Parameters:
    ///   - pipelineName: The name of the pipeline to start.
    ///   - logger: Logger use during operation
    @inlinable
    public func startPipeline(
        pipelineName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StartPipelineResponse {
        let input = StartPipelineRequest(
            pipelineName: pipelineName
        )
        return try await self.startPipeline(input, logger: logger)
    }

    /// Stops an OpenSearch Ingestion pipeline. For more information, see Stopping an OpenSearch Ingestion pipeline.
    @Sendable
    @inlinable
    public func stopPipeline(_ input: StopPipelineRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> StopPipelineResponse {
        try await self.client.execute(
            operation: "StopPipeline", 
            path: "/2022-01-01/osis/stopPipeline/{PipelineName}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Stops an OpenSearch Ingestion pipeline. For more information, see Stopping an OpenSearch Ingestion pipeline.
    ///
    /// Parameters:
    ///   - pipelineName: The name of the pipeline to stop.
    ///   - logger: Logger use during operation
    @inlinable
    public func stopPipeline(
        pipelineName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StopPipelineResponse {
        let input = StopPipelineRequest(
            pipelineName: pipelineName
        )
        return try await self.stopPipeline(input, logger: logger)
    }

    /// Tags an OpenSearch Ingestion pipeline. For more information, see Tagging Amazon OpenSearch Ingestion pipelines.
    @Sendable
    @inlinable
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> TagResourceResponse {
        try await self.client.execute(
            operation: "TagResource", 
            path: "/2022-01-01/osis/tagResource", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Tags an OpenSearch Ingestion pipeline. For more information, see Tagging Amazon OpenSearch Ingestion pipelines.
    ///
    /// Parameters:
    ///   - arn: The Amazon Resource Name (ARN) of the pipeline to tag.
    ///   - tags: The list of key-value tags to add to the pipeline.
    ///   - logger: Logger use during operation
    @inlinable
    public func tagResource(
        arn: String,
        tags: [Tag],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> TagResourceResponse {
        let input = TagResourceRequest(
            arn: arn, 
            tags: tags
        )
        return try await self.tagResource(input, logger: logger)
    }

    /// Removes one or more tags from an OpenSearch Ingestion pipeline. For more information, see Tagging Amazon OpenSearch Ingestion pipelines.
    @Sendable
    @inlinable
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UntagResourceResponse {
        try await self.client.execute(
            operation: "UntagResource", 
            path: "/2022-01-01/osis/untagResource", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes one or more tags from an OpenSearch Ingestion pipeline. For more information, see Tagging Amazon OpenSearch Ingestion pipelines.
    ///
    /// Parameters:
    ///   - arn: The Amazon Resource Name (ARN) of the pipeline to remove tags from.
    ///   - tagKeys: The tag keys to remove.
    ///   - logger: Logger use during operation
    @inlinable
    public func untagResource(
        arn: String,
        tagKeys: [String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UntagResourceResponse {
        let input = UntagResourceRequest(
            arn: arn, 
            tagKeys: tagKeys
        )
        return try await self.untagResource(input, logger: logger)
    }

    /// Updates an OpenSearch Ingestion pipeline. For more information, see Updating Amazon OpenSearch Ingestion pipelines.
    @Sendable
    @inlinable
    public func updatePipeline(_ input: UpdatePipelineRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdatePipelineResponse {
        try await self.client.execute(
            operation: "UpdatePipeline", 
            path: "/2022-01-01/osis/updatePipeline/{PipelineName}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates an OpenSearch Ingestion pipeline. For more information, see Updating Amazon OpenSearch Ingestion pipelines.
    ///
    /// Parameters:
    ///   - bufferOptions: Key-value pairs to configure persistent buffering for the pipeline.
    ///   - encryptionAtRestOptions: Key-value pairs to configure encryption for data that is written to a persistent buffer.
    ///   - logPublishingOptions: Key-value pairs to configure log publishing.
    ///   - maxUnits: The maximum pipeline capacity, in Ingestion Compute Units (ICUs)
    ///   - minUnits: The minimum pipeline capacity, in Ingestion Compute Units (ICUs).
    ///   - pipelineConfigurationBody: The pipeline configuration in YAML format. The command accepts the pipeline configuration as a string or within a .yaml file. If you provide the configuration as a string, each new line must be escaped with \n.
    ///   - pipelineName: The name of the pipeline to update.
    ///   - logger: Logger use during operation
    @inlinable
    public func updatePipeline(
        bufferOptions: BufferOptions? = nil,
        encryptionAtRestOptions: EncryptionAtRestOptions? = nil,
        logPublishingOptions: LogPublishingOptions? = nil,
        maxUnits: Int? = nil,
        minUnits: Int? = nil,
        pipelineConfigurationBody: String? = nil,
        pipelineName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdatePipelineResponse {
        let input = UpdatePipelineRequest(
            bufferOptions: bufferOptions, 
            encryptionAtRestOptions: encryptionAtRestOptions, 
            logPublishingOptions: logPublishingOptions, 
            maxUnits: maxUnits, 
            minUnits: minUnits, 
            pipelineConfigurationBody: pipelineConfigurationBody, 
            pipelineName: pipelineName
        )
        return try await self.updatePipeline(input, logger: logger)
    }

    /// Checks whether an OpenSearch Ingestion pipeline configuration is valid prior to creation. For more information, see Creating Amazon OpenSearch Ingestion pipelines.
    @Sendable
    @inlinable
    public func validatePipeline(_ input: ValidatePipelineRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ValidatePipelineResponse {
        try await self.client.execute(
            operation: "ValidatePipeline", 
            path: "/2022-01-01/osis/validatePipeline", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Checks whether an OpenSearch Ingestion pipeline configuration is valid prior to creation. For more information, see Creating Amazon OpenSearch Ingestion pipelines.
    ///
    /// Parameters:
    ///   - pipelineConfigurationBody: The pipeline configuration in YAML format. The command accepts the pipeline configuration as a string or within a .yaml file. If you provide the configuration as a string, each new line must be escaped with \n.
    ///   - logger: Logger use during operation
    @inlinable
    public func validatePipeline(
        pipelineConfigurationBody: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ValidatePipelineResponse {
        let input = ValidatePipelineRequest(
            pipelineConfigurationBody: pipelineConfigurationBody
        )
        return try await self.validatePipeline(input, logger: logger)
    }
}

extension OSIS {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: OSIS, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension OSIS {
    /// Return PaginatorSequence for operation ``listPipelines(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listPipelinesPaginator(
        _ input: ListPipelinesRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListPipelinesRequest, ListPipelinesResponse> {
        return .init(
            input: input,
            command: self.listPipelines,
            inputKey: \ListPipelinesRequest.nextToken,
            outputKey: \ListPipelinesResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listPipelines(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: An optional parameter that specifies the maximum number of results to return. You can use nextToken to get the next page of results.
    ///   - logger: Logger used for logging
    @inlinable
    public func listPipelinesPaginator(
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListPipelinesRequest, ListPipelinesResponse> {
        let input = ListPipelinesRequest(
            maxResults: maxResults
        )
        return self.listPipelinesPaginator(input, logger: logger)
    }
}

extension OSIS.ListPipelinesRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> OSIS.ListPipelinesRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}
